import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MouseGUI {
	
	private JFrame frame;
	private JButton botoia;
	private JLabel label;
	
	public MouseGUI(){
		lehioaSortu();
		botoiaSortu();
		etiketaSortu();
	
	}

	
	private void etiketaSortu(){
		label = new JLabel();
		frame.getContentPane().add(label, BorderLayout.SOUTH);
		
	}

	private void botoiaSortu() {
		botoia = new JButton("Sartu mesedez.");
		botoia.setSize(200, 100);
		botoia.addMouseListener(new MouseAdapter(){
			public void mouseEntered(MouseEvent e){
				label.setText("Ez sartu hain azkar");
			}
		});
		
		botoia.addMouseListener(new MouseAdapter(){
			public void mouseExited(MouseEvent e){
				label.setText("Ez joan!");
			}
		});
		
		botoia.addMouseMotionListener(new MouseAdapter(){
			public void mouseDragged(MouseEvent e){
				label.setText("Ze habil arrastaka?");
			}
		});
		
		frame.getContentPane().add(botoia, BorderLayout.CENTER);
	}
	
	public void lehioaSortu(){
		frame = new JFrame();
		frame.setVisible(true);
		frame.setSize(400,300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.pack();
	}
	
	public static void main(String[] args) {
		MouseGUI m = new MouseGUI();

	}
}
